// $ANTLR 3.1.1 RiseCollectionFormulaServerAST.g 2009-12-24 15:56:06

package cn.newtest.bi.collection.formula.antlr;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.antlr.runtime.BitSet;
import org.antlr.runtime.EarlyExitException;
import org.antlr.runtime.MismatchedSetException;
import org.antlr.runtime.NoViableAltException;
import org.antlr.runtime.RecognitionException;
import org.antlr.runtime.RecognizerSharedState;
import org.antlr.runtime.Token;
import org.antlr.runtime.tree.CommonTree;
import org.antlr.runtime.tree.Tree;
import org.antlr.runtime.tree.TreeNodeStream;
import org.antlr.runtime.tree.TreeParser;
import org.antlr.runtime.tree.TreeRuleReturnScope;
public class RiseCollectionFormulaServerAST extends TreeParser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "DECINODE", "FOR", "ENDFOR", "FOREACH", "ENDFOREACH", "IF", "ENDIF", "ELSE", "Identifier", "AS", "OPEN", "DecimalLiteral", "LY", "SURE", "StringLiteral", "IN", "TO", "RANGECELL", "INDICATIONCELL", "ZZJGDM", "TBR", "BGQ", "TBRQ", "QYMC", "LEN", "NOTEMPTY", "EMPTY", "ABS", "RPCELL", "Letter", "FloatingPointLiteral", "CharacterLiteral", "EscapeSequence", "UnicodeEscape", "OctalEscape", "HexDigit", "WS", "COMMENT", "LINE_COMMENT", "'='", "'.'", "'-'", "'('", "')'", "','", "'['", "']'", "'||'", "'&&'", "'=='", "'!='", "'<>'", "'>='", "'<='", "'>'", "'<'", "'+'", "'*'", "'/'", "'%'", "'+...+'", "'null'", "'true'", "'false'", "'+..+'"
    };
    public static final int AS=13;
    public static final int T__57=57;
    public static final int HexDigit=39;
    public static final int ZZJGDM=23;
    public static final int T__51=51;
    public static final int T__47=47;
    public static final int T__50=50;
    public static final int T__65=65;
    public static final int TBRQ=26;
    public static final int T__67=67;
    public static final int Letter=33;
    public static final int TO=20;
    public static final int T__46=46;
    public static final int T__52=52;
    public static final int T__68=68;
    public static final int T__62=62;
    public static final int EscapeSequence=36;
    public static final int T__49=49;
    public static final int T__61=61;
    public static final int DECINODE=4;
    public static final int T__59=59;
    public static final int T__54=54;
    public static final int T__48=48;
    public static final int LEN=28;
    public static final int FloatingPointLiteral=34;
    public static final int QYMC=27;
    public static final int T__56=56;
    public static final int ENDIF=10;
    public static final int EMPTY=30;
    public static final int TBR=24;
    public static final int Identifier=12;
    public static final int WS=40;
    public static final int CharacterLiteral=35;
    public static final int T__58=58;
    public static final int BGQ=25;
    public static final int T__64=64;
    public static final int ENDFOR=6;
    public static final int T__44=44;
    public static final int ENDFOREACH=8;
    public static final int T__66=66;
    public static final int COMMENT=41;
    public static final int StringLiteral=18;
    public static final int LY=16;
    public static final int RANGECELL=21;
    public static final int LINE_COMMENT=42;
    public static final int T__45=45;
    public static final int T__55=55;
    public static final int IN=19;
    public static final int UnicodeEscape=37;
    public static final int INDICATIONCELL=22;
    public static final int ELSE=11;
    public static final int T__63=63;
    public static final int ABS=31;
    public static final int NOTEMPTY=29;
    public static final int T__43=43;
    public static final int IF=9;
    public static final int OPEN=14;
    public static final int EOF=-1;
    public static final int DecimalLiteral=15;
    public static final int T__53=53;
    public static final int RPCELL=32;
    public static final int SURE=17;
    public static final int FOR=5;
    public static final int OctalEscape=38;
    public static final int T__60=60;
    public static final int FOREACH=7;

    // delegates
    // delegators


        public RiseCollectionFormulaServerAST(TreeNodeStream input) {
            this(input, new RecognizerSharedState());
        }
        public RiseCollectionFormulaServerAST(TreeNodeStream input, RecognizerSharedState state) {
            super(input, state);
             
        }
        

    public String[] getTokenNames() { return RiseCollectionFormulaServerAST.tokenNames; }
    public String getGrammarFileName() { return "RiseCollectionFormulaServerAST.g"; }


    	Map memory = new HashMap();
    	StringBuffer sb = new StringBuffer();
    	
    	protected void out(String s) {
    		sb.append(s);
    	}
    	
    	public String getOut() {
    		return sb.toString();
    	}
    	
    	protected void separator(CommonTree n, String sep) {
    		if(n.getToken().getTokenIndex()!=n.getParent().getTokenStopIndex())
    			out(sep);
    	}
    	
    	protected String getCells(CommonTree n) {
    	    	List<String> cells = new ArrayList<String>();
    	    	this.getAllSubTree(n, cells);
    	    	String reValue = "";
    	    	for(int i=0;i<cells.size();i++){
    	    		if(reValue.equals(""))
    	    			reValue = cells.get(i);
    	    		else
    	    			reValue += "@@@"+cells.get(i);
    	    	}
    	    	return reValue;
        	}
        	
    	private void getAllSubTree(CommonTree n,List<String> cells){
    		int count = n.getChildCount();
    		for(int i=0;i<count;i++){
    			Tree tree = n.getChild(i);
    			if(tree.getType()==RANGECELL||tree.getType()==INDICATIONCELL){
        				cells.add(tree.toString());
        			}
        		this.getAllSubTree((CommonTree)tree, cells);
        		}
    	}



    // $ANTLR start "prog"
    // RiseCollectionFormulaServerAST.g:55:1: prog : ( statement )+ EOF ;
    public final void prog() throws RecognitionException {
        try {
            // RiseCollectionFormulaServerAST.g:55:6: ( ( statement )+ EOF )
            // RiseCollectionFormulaServerAST.g:55:8: ( statement )+ EOF
            {
            // RiseCollectionFormulaServerAST.g:55:8: ( statement )+
            int cnt1=0;
            loop1:
            do {
                int alt1=2;
                int LA1_0 = input.LA(1);

                if ( (LA1_0==FOR||LA1_0==FOREACH||LA1_0==IF||(LA1_0>=AS && LA1_0<=OPEN)||LA1_0==SURE||LA1_0==43) ) {
                    alt1=1;
                }


                switch (alt1) {
            	case 1 :
            	    // RiseCollectionFormulaServerAST.g:0:0: statement
            	    {
            	    pushFollow(FOLLOW_statement_in_prog56);
            	    statement();

            	    state._fsp--;
            	    if (state.failed) return ;

            	    }
            	    break;

            	default :
            	    if ( cnt1 >= 1 ) break loop1;
            	    if (state.backtracking>0) {state.failed=true; return ;}
                        EarlyExitException eee =
                            new EarlyExitException(1, input);
                        throw eee;
                }
                cnt1++;
            } while (true);

            match(input,EOF,FOLLOW_EOF_in_prog59); if (state.failed) return ;

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "prog"


    // $ANTLR start "statement"
    // RiseCollectionFormulaServerAST.g:58:1: statement : ( ifStatement | ^( FOR inListStatement ( statement )* ) | ^( FOREACH ( statement )* ) | assignStatement | asAssignStatement | openStatement | functionStatement );
    public final void statement() throws RecognitionException {
        try {
            // RiseCollectionFormulaServerAST.g:59:2: ( ifStatement | ^( FOR inListStatement ( statement )* ) | ^( FOREACH ( statement )* ) | assignStatement | asAssignStatement | openStatement | functionStatement )
            int alt4=7;
            switch ( input.LA(1) ) {
            case IF:
                {
                alt4=1;
                }
                break;
            case FOR:
                {
                alt4=2;
                }
                break;
            case FOREACH:
                {
                alt4=3;
                }
                break;
            case 43:
                {
                alt4=4;
                }
                break;
            case AS:
                {
                alt4=5;
                }
                break;
            case OPEN:
                {
                alt4=6;
                }
                break;
            case SURE:
                {
                alt4=7;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return ;}
                NoViableAltException nvae =
                    new NoViableAltException("", 4, 0, input);

                throw nvae;
            }

            switch (alt4) {
                case 1 :
                    // RiseCollectionFormulaServerAST.g:59:4: ifStatement
                    {
                    pushFollow(FOLLOW_ifStatement_in_statement70);
                    ifStatement();

                    state._fsp--;
                    if (state.failed) return ;

                    }
                    break;
                case 2 :
                    // RiseCollectionFormulaServerAST.g:60:4: ^( FOR inListStatement ( statement )* )
                    {
                    match(input,FOR,FOLLOW_FOR_in_statement76); if (state.failed) return ;

                    match(input, Token.DOWN, null); if (state.failed) return ;
                    pushFollow(FOLLOW_inListStatement_in_statement78);
                    inListStatement();

                    state._fsp--;
                    if (state.failed) return ;
                    // RiseCollectionFormulaServerAST.g:60:26: ( statement )*
                    loop2:
                    do {
                        int alt2=2;
                        int LA2_0 = input.LA(1);

                        if ( (LA2_0==FOR||LA2_0==FOREACH||LA2_0==IF||(LA2_0>=AS && LA2_0<=OPEN)||LA2_0==SURE||LA2_0==43) ) {
                            alt2=1;
                        }


                        switch (alt2) {
                    	case 1 :
                    	    // RiseCollectionFormulaServerAST.g:0:0: statement
                    	    {
                    	    pushFollow(FOLLOW_statement_in_statement80);
                    	    statement();

                    	    state._fsp--;
                    	    if (state.failed) return ;

                    	    }
                    	    break;

                    	default :
                    	    break loop2;
                        }
                    } while (true);

                    if ( state.backtracking==0 ) {
                      out("}\r");
                    }

                    match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 3 :
                    // RiseCollectionFormulaServerAST.g:61:4: ^( FOREACH ( statement )* )
                    {
                    match(input,FOREACH,FOLLOW_FOREACH_in_statement90); if (state.failed) return ;

                    if ( state.backtracking==0 ) {

                      	    		out("foreachClosure(){\r");
                      	    		
                      			out("Map map = new HashMap()\r");
                      			out("def b = false\r");
                      			out("def i = 0\r");
                      			out("while(!b){\r");
                      	    	
                    }

                    if ( input.LA(1)==Token.DOWN ) {
                        match(input, Token.DOWN, null); if (state.failed) return ;
                        // RiseCollectionFormulaServerAST.g:70:7: ( statement )*
                        loop3:
                        do {
                            int alt3=2;
                            int LA3_0 = input.LA(1);

                            if ( (LA3_0==FOR||LA3_0==FOREACH||LA3_0==IF||(LA3_0>=AS && LA3_0<=OPEN)||LA3_0==SURE||LA3_0==43) ) {
                                alt3=1;
                            }


                            switch (alt3) {
                        	case 1 :
                        	    // RiseCollectionFormulaServerAST.g:0:0: statement
                        	    {
                        	    pushFollow(FOLLOW_statement_in_statement106);
                        	    statement();

                        	    state._fsp--;
                        	    if (state.failed) return ;

                        	    }
                        	    break;

                        	default :
                        	    break loop3;
                            }
                        } while (true);


                        match(input, Token.UP, null); if (state.failed) return ;
                    }
                    if ( state.backtracking==0 ) {

                      	    		out("setExitCode(rangeListMap,map)\r");
                      	    		out("b=map.get(\"exitCode\")\r");
                      	    		out("if(b==null)\r");
                      			out("b=true\r");
                      			out("if(i==2000)\r");
                      			out("b = true\r");
                      			out("else\r");
                      			out("i++\r");
                      			out("}\r");
                      			
                      			out("}\r");
                      					
                      	    	
                    }

                    }
                    break;
                case 4 :
                    // RiseCollectionFormulaServerAST.g:85:5: assignStatement
                    {
                    pushFollow(FOLLOW_assignStatement_in_statement122);
                    assignStatement();

                    state._fsp--;
                    if (state.failed) return ;

                    }
                    break;
                case 5 :
                    // RiseCollectionFormulaServerAST.g:86:4: asAssignStatement
                    {
                    pushFollow(FOLLOW_asAssignStatement_in_statement127);
                    asAssignStatement();

                    state._fsp--;
                    if (state.failed) return ;

                    }
                    break;
                case 6 :
                    // RiseCollectionFormulaServerAST.g:87:4: openStatement
                    {
                    pushFollow(FOLLOW_openStatement_in_statement132);
                    openStatement();

                    state._fsp--;
                    if (state.failed) return ;

                    }
                    break;
                case 7 :
                    // RiseCollectionFormulaServerAST.g:88:4: functionStatement
                    {
                    pushFollow(FOLLOW_functionStatement_in_statement137);
                    functionStatement();

                    state._fsp--;
                    if (state.failed) return ;

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "statement"


    // $ANTLR start "ifStatement"
    // RiseCollectionFormulaServerAST.g:92:1: ifStatement : ^( IF expression ( statement )* ( elseStatement )? ) ;
    public final void ifStatement() throws RecognitionException {
        try {
            // RiseCollectionFormulaServerAST.g:93:2: ( ^( IF expression ( statement )* ( elseStatement )? ) )
            // RiseCollectionFormulaServerAST.g:93:4: ^( IF expression ( statement )* ( elseStatement )? )
            {
            match(input,IF,FOLLOW_IF_in_ifStatement152); if (state.failed) return ;

            if ( state.backtracking==0 ) {
              out("if(");
            }

            match(input, Token.DOWN, null); if (state.failed) return ;
            pushFollow(FOLLOW_expression_in_ifStatement156);
            expression();

            state._fsp--;
            if (state.failed) return ;
            if ( state.backtracking==0 ) {
              out("){\r");
            }
            // RiseCollectionFormulaServerAST.g:93:49: ( statement )*
            loop5:
            do {
                int alt5=2;
                int LA5_0 = input.LA(1);

                if ( (LA5_0==FOR||LA5_0==FOREACH||LA5_0==IF||(LA5_0>=AS && LA5_0<=OPEN)||LA5_0==SURE||LA5_0==43) ) {
                    alt5=1;
                }


                switch (alt5) {
            	case 1 :
            	    // RiseCollectionFormulaServerAST.g:0:0: statement
            	    {
            	    pushFollow(FOLLOW_statement_in_ifStatement160);
            	    statement();

            	    state._fsp--;
            	    if (state.failed) return ;

            	    }
            	    break;

            	default :
            	    break loop5;
                }
            } while (true);

            if ( state.backtracking==0 ) {
              out("}else{\r");
            }
            // RiseCollectionFormulaServerAST.g:93:79: ( elseStatement )?
            int alt6=2;
            int LA6_0 = input.LA(1);

            if ( (LA6_0==ELSE) ) {
                alt6=1;
            }
            switch (alt6) {
                case 1 :
                    // RiseCollectionFormulaServerAST.g:0:0: elseStatement
                    {
                    pushFollow(FOLLOW_elseStatement_in_ifStatement165);
                    elseStatement();

                    state._fsp--;
                    if (state.failed) return ;

                    }
                    break;

            }

            if ( state.backtracking==0 ) {
              out("}\r");
            }

            match(input, Token.UP, null); if (state.failed) return ;

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "ifStatement"


    // $ANTLR start "elseStatement"
    // RiseCollectionFormulaServerAST.g:96:1: elseStatement : ^( ELSE ( statement )* ) ;
    public final void elseStatement() throws RecognitionException {
        try {
            // RiseCollectionFormulaServerAST.g:97:2: ( ^( ELSE ( statement )* ) )
            // RiseCollectionFormulaServerAST.g:97:4: ^( ELSE ( statement )* )
            {
            match(input,ELSE,FOLLOW_ELSE_in_elseStatement182); if (state.failed) return ;

            if ( input.LA(1)==Token.DOWN ) {
                match(input, Token.DOWN, null); if (state.failed) return ;
                // RiseCollectionFormulaServerAST.g:97:11: ( statement )*
                loop7:
                do {
                    int alt7=2;
                    int LA7_0 = input.LA(1);

                    if ( (LA7_0==FOR||LA7_0==FOREACH||LA7_0==IF||(LA7_0>=AS && LA7_0<=OPEN)||LA7_0==SURE||LA7_0==43) ) {
                        alt7=1;
                    }


                    switch (alt7) {
                	case 1 :
                	    // RiseCollectionFormulaServerAST.g:0:0: statement
                	    {
                	    pushFollow(FOLLOW_statement_in_elseStatement184);
                	    statement();

                	    state._fsp--;
                	    if (state.failed) return ;

                	    }
                	    break;

                	default :
                	    break loop7;
                    }
                } while (true);


                match(input, Token.UP, null); if (state.failed) return ;
            }

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "elseStatement"


    // $ANTLR start "assignStatement"
    // RiseCollectionFormulaServerAST.g:100:1: assignStatement : ^( '=' ak= assignkeywords refe= referenceassign ) ;
    public final void assignStatement() throws RecognitionException {
        String ak = null;

        String refe = null;


        try {
            // RiseCollectionFormulaServerAST.g:101:2: ( ^( '=' ak= assignkeywords refe= referenceassign ) )
            // RiseCollectionFormulaServerAST.g:101:4: ^( '=' ak= assignkeywords refe= referenceassign )
            {
            match(input,43,FOLLOW_43_in_assignStatement199); if (state.failed) return ;

            match(input, Token.DOWN, null); if (state.failed) return ;
            pushFollow(FOLLOW_assignkeywords_in_assignStatement203);
            ak=assignkeywords();

            state._fsp--;
            if (state.failed) return ;
            pushFollow(FOLLOW_referenceassign_in_assignStatement207);
            refe=referenceassign();

            state._fsp--;
            if (state.failed) return ;

            match(input, Token.UP, null); if (state.failed) return ;
            if ( state.backtracking==0 ) {

              			out("assign(\""+ak+"\","+refe+")\r");
              		
            }

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "assignStatement"


    // $ANTLR start "asAssignStatement"
    // RiseCollectionFormulaServerAST.g:107:1: asAssignStatement : ( ^( AS id1= Identifier id2= Identifier ) | ^( AS id3= Identifier id4= Identifier id5= Identifier ) );
    public final void asAssignStatement() throws RecognitionException {
        CommonTree id1=null;
        CommonTree id2=null;
        CommonTree id3=null;
        CommonTree id4=null;
        CommonTree id5=null;

        try {
            // RiseCollectionFormulaServerAST.g:108:2: ( ^( AS id1= Identifier id2= Identifier ) | ^( AS id3= Identifier id4= Identifier id5= Identifier ) )
            int alt8=2;
            int LA8_0 = input.LA(1);

            if ( (LA8_0==AS) ) {
                int LA8_1 = input.LA(2);

                if ( (LA8_1==DOWN) ) {
                    int LA8_2 = input.LA(3);

                    if ( (LA8_2==Identifier) ) {
                        int LA8_3 = input.LA(4);

                        if ( (LA8_3==Identifier) ) {
                            int LA8_4 = input.LA(5);

                            if ( (LA8_4==UP) ) {
                                alt8=1;
                            }
                            else if ( (LA8_4==Identifier) ) {
                                alt8=2;
                            }
                            else {
                                if (state.backtracking>0) {state.failed=true; return ;}
                                NoViableAltException nvae =
                                    new NoViableAltException("", 8, 4, input);

                                throw nvae;
                            }
                        }
                        else {
                            if (state.backtracking>0) {state.failed=true; return ;}
                            NoViableAltException nvae =
                                new NoViableAltException("", 8, 3, input);

                            throw nvae;
                        }
                    }
                    else {
                        if (state.backtracking>0) {state.failed=true; return ;}
                        NoViableAltException nvae =
                            new NoViableAltException("", 8, 2, input);

                        throw nvae;
                    }
                }
                else {
                    if (state.backtracking>0) {state.failed=true; return ;}
                    NoViableAltException nvae =
                        new NoViableAltException("", 8, 1, input);

                    throw nvae;
                }
            }
            else {
                if (state.backtracking>0) {state.failed=true; return ;}
                NoViableAltException nvae =
                    new NoViableAltException("", 8, 0, input);

                throw nvae;
            }
            switch (alt8) {
                case 1 :
                    // RiseCollectionFormulaServerAST.g:108:4: ^( AS id1= Identifier id2= Identifier )
                    {
                    match(input,AS,FOLLOW_AS_in_asAssignStatement225); if (state.failed) return ;

                    match(input, Token.DOWN, null); if (state.failed) return ;
                    id1=(CommonTree)match(input,Identifier,FOLLOW_Identifier_in_asAssignStatement229); if (state.failed) return ;
                    id2=(CommonTree)match(input,Identifier,FOLLOW_Identifier_in_asAssignStatement233); if (state.failed) return ;

                    match(input, Token.UP, null); if (state.failed) return ;
                    if ( state.backtracking==0 ) {

                      			out("proAlias.put(\""+id1+"\",\""+id2+"\")\r");
                      			out("proAliasReverse.put(\""+id2+"\",\""+id1+"\")\r");
                      		
                    }

                    }
                    break;
                case 2 :
                    // RiseCollectionFormulaServerAST.g:113:4: ^( AS id3= Identifier id4= Identifier id5= Identifier )
                    {
                    match(input,AS,FOLLOW_AS_in_asAssignStatement245); if (state.failed) return ;

                    match(input, Token.DOWN, null); if (state.failed) return ;
                    id3=(CommonTree)match(input,Identifier,FOLLOW_Identifier_in_asAssignStatement249); if (state.failed) return ;
                    id4=(CommonTree)match(input,Identifier,FOLLOW_Identifier_in_asAssignStatement253); if (state.failed) return ;
                    id5=(CommonTree)match(input,Identifier,FOLLOW_Identifier_in_asAssignStatement257); if (state.failed) return ;

                    match(input, Token.UP, null); if (state.failed) return ;
                    if ( state.backtracking==0 ) {

                      			out("proAlias.put(\""+(id3!=null?id3.getText():null)+"."+(id4!=null?id4.getText():null)+"\",\""+id5+"\")\r");
                      			out("proAliasReverse.put(\""+id5+"\",\""+id3+"."+(id4!=null?id4.getText():null)+"\")\r");
                      		
                    }

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "asAssignStatement"


    // $ANTLR start "openStatement"
    // RiseCollectionFormulaServerAST.g:120:1: openStatement : ( ^( OPEN rdName1= Identifier (id1= Identifier )? (de1= DecimalLiteral )? ) | ^( OPEN rdName2= Identifier LY (id2= Identifier )? (de2= DecimalLiteral )? ) );
    public final void openStatement() throws RecognitionException {
        CommonTree rdName1=null;
        CommonTree id1=null;
        CommonTree de1=null;
        CommonTree rdName2=null;
        CommonTree id2=null;
        CommonTree de2=null;

        try {
            // RiseCollectionFormulaServerAST.g:121:2: ( ^( OPEN rdName1= Identifier (id1= Identifier )? (de1= DecimalLiteral )? ) | ^( OPEN rdName2= Identifier LY (id2= Identifier )? (de2= DecimalLiteral )? ) )
            int alt13=2;
            int LA13_0 = input.LA(1);

            if ( (LA13_0==OPEN) ) {
                int LA13_1 = input.LA(2);

                if ( (LA13_1==DOWN) ) {
                    int LA13_2 = input.LA(3);

                    if ( (LA13_2==Identifier) ) {
                        int LA13_3 = input.LA(4);

                        if ( (LA13_3==LY) ) {
                            alt13=2;
                        }
                        else if ( (LA13_3==UP||LA13_3==Identifier||LA13_3==DecimalLiteral) ) {
                            alt13=1;
                        }
                        else {
                            if (state.backtracking>0) {state.failed=true; return ;}
                            NoViableAltException nvae =
                                new NoViableAltException("", 13, 3, input);

                            throw nvae;
                        }
                    }
                    else {
                        if (state.backtracking>0) {state.failed=true; return ;}
                        NoViableAltException nvae =
                            new NoViableAltException("", 13, 2, input);

                        throw nvae;
                    }
                }
                else {
                    if (state.backtracking>0) {state.failed=true; return ;}
                    NoViableAltException nvae =
                        new NoViableAltException("", 13, 1, input);

                    throw nvae;
                }
            }
            else {
                if (state.backtracking>0) {state.failed=true; return ;}
                NoViableAltException nvae =
                    new NoViableAltException("", 13, 0, input);

                throw nvae;
            }
            switch (alt13) {
                case 1 :
                    // RiseCollectionFormulaServerAST.g:121:4: ^( OPEN rdName1= Identifier (id1= Identifier )? (de1= DecimalLiteral )? )
                    {
                    match(input,OPEN,FOLLOW_OPEN_in_openStatement275); if (state.failed) return ;

                    match(input, Token.DOWN, null); if (state.failed) return ;
                    rdName1=(CommonTree)match(input,Identifier,FOLLOW_Identifier_in_openStatement279); if (state.failed) return ;
                    // RiseCollectionFormulaServerAST.g:121:33: (id1= Identifier )?
                    int alt9=2;
                    int LA9_0 = input.LA(1);

                    if ( (LA9_0==Identifier) ) {
                        alt9=1;
                    }
                    switch (alt9) {
                        case 1 :
                            // RiseCollectionFormulaServerAST.g:0:0: id1= Identifier
                            {
                            id1=(CommonTree)match(input,Identifier,FOLLOW_Identifier_in_openStatement283); if (state.failed) return ;

                            }
                            break;

                    }

                    // RiseCollectionFormulaServerAST.g:121:49: (de1= DecimalLiteral )?
                    int alt10=2;
                    int LA10_0 = input.LA(1);

                    if ( (LA10_0==DecimalLiteral) ) {
                        alt10=1;
                    }
                    switch (alt10) {
                        case 1 :
                            // RiseCollectionFormulaServerAST.g:0:0: de1= DecimalLiteral
                            {
                            de1=(CommonTree)match(input,DecimalLiteral,FOLLOW_DecimalLiteral_in_openStatement288); if (state.failed) return ;

                            }
                            break;

                    }


                    match(input, Token.UP, null); if (state.failed) return ;
                    if ( state.backtracking==0 ) {

                      			String templateCode = "";
                      			if(id1!=null)
                      				templateCode = (id1!=null?id1.getText():null);
                      			int offset = 0;
                      			if(de1!=null&&!(de1!=null?de1.getText():null).equals(""))
                      				offset = Integer.valueOf((de1!=null?de1.getText():null));
                      			out("openRd(\""+rdName1+"\",\""+templateCode+"\","+offset+",false)\r");
                      		
                    }

                    }
                    break;
                case 2 :
                    // RiseCollectionFormulaServerAST.g:131:4: ^( OPEN rdName2= Identifier LY (id2= Identifier )? (de2= DecimalLiteral )? )
                    {
                    match(input,OPEN,FOLLOW_OPEN_in_openStatement300); if (state.failed) return ;

                    match(input, Token.DOWN, null); if (state.failed) return ;
                    rdName2=(CommonTree)match(input,Identifier,FOLLOW_Identifier_in_openStatement304); if (state.failed) return ;
                    match(input,LY,FOLLOW_LY_in_openStatement306); if (state.failed) return ;
                    // RiseCollectionFormulaServerAST.g:131:36: (id2= Identifier )?
                    int alt11=2;
                    int LA11_0 = input.LA(1);

                    if ( (LA11_0==Identifier) ) {
                        alt11=1;
                    }
                    switch (alt11) {
                        case 1 :
                            // RiseCollectionFormulaServerAST.g:0:0: id2= Identifier
                            {
                            id2=(CommonTree)match(input,Identifier,FOLLOW_Identifier_in_openStatement310); if (state.failed) return ;

                            }
                            break;

                    }

                    // RiseCollectionFormulaServerAST.g:131:52: (de2= DecimalLiteral )?
                    int alt12=2;
                    int LA12_0 = input.LA(1);

                    if ( (LA12_0==DecimalLiteral) ) {
                        alt12=1;
                    }
                    switch (alt12) {
                        case 1 :
                            // RiseCollectionFormulaServerAST.g:0:0: de2= DecimalLiteral
                            {
                            de2=(CommonTree)match(input,DecimalLiteral,FOLLOW_DecimalLiteral_in_openStatement315); if (state.failed) return ;

                            }
                            break;

                    }


                    match(input, Token.UP, null); if (state.failed) return ;
                    if ( state.backtracking==0 ) {

                      			String templateCode = "";
                      			if(id2!=null)
                      				templateCode = (id2!=null?id2.getText():null);
                      			int offset = 0;
                      			if(de2!=null&&!(de2!=null?de2.getText():null).equals(""))
                      				offset = Integer.valueOf((de2!=null?de2.getText():null));
                      			out("openRd(\""+rdName2+"\",\""+templateCode+"\","+offset+",true)\r");
                      		
                    }

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "openStatement"


    // $ANTLR start "functionStatement"
    // RiseCollectionFormulaServerAST.g:143:1: functionStatement : ( duplicateSureStatement )+ ;
    public final void functionStatement() throws RecognitionException {
        try {
            // RiseCollectionFormulaServerAST.g:144:2: ( ( duplicateSureStatement )+ )
            // RiseCollectionFormulaServerAST.g:144:4: ( duplicateSureStatement )+
            {
            // RiseCollectionFormulaServerAST.g:144:4: ( duplicateSureStatement )+
            int cnt14=0;
            loop14:
            do {
                int alt14=2;
                int LA14_0 = input.LA(1);

                if ( (LA14_0==SURE) ) {
                    int LA14_2 = input.LA(2);

                    if ( (synpred19_RiseCollectionFormulaServerAST()) ) {
                        alt14=1;
                    }


                }


                switch (alt14) {
            	case 1 :
            	    // RiseCollectionFormulaServerAST.g:0:0: duplicateSureStatement
            	    {
            	    pushFollow(FOLLOW_duplicateSureStatement_in_functionStatement333);
            	    duplicateSureStatement();

            	    state._fsp--;
            	    if (state.failed) return ;

            	    }
            	    break;

            	default :
            	    if ( cnt14 >= 1 ) break loop14;
            	    if (state.backtracking>0) {state.failed=true; return ;}
                        EarlyExitException eee =
                            new EarlyExitException(14, input);
                        throw eee;
                }
                cnt14++;
            } while (true);


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "functionStatement"


    // $ANTLR start "duplicateSureStatement"
    // RiseCollectionFormulaServerAST.g:147:1: duplicateSureStatement : ^( SURE ex= expression st= StringLiteral ) ;
    public final void duplicateSureStatement() throws RecognitionException {
        CommonTree st=null;
        RiseCollectionFormulaServerAST.expression_return ex = null;


        try {
            // RiseCollectionFormulaServerAST.g:148:2: ( ^( SURE ex= expression st= StringLiteral ) )
            // RiseCollectionFormulaServerAST.g:148:4: ^( SURE ex= expression st= StringLiteral )
            {
            match(input,SURE,FOLLOW_SURE_in_duplicateSureStatement347); if (state.failed) return ;

            if ( state.backtracking==0 ) {

              			out("try{\r");
              			out("sure(");
              		
            }

            match(input, Token.DOWN, null); if (state.failed) return ;
            pushFollow(FOLLOW_expression_in_duplicateSureStatement361);
            ex=expression();

            state._fsp--;
            if (state.failed) return ;
            st=(CommonTree)match(input,StringLiteral,FOLLOW_StringLiteral_in_duplicateSureStatement365); if (state.failed) return ;

            match(input, Token.UP, null); if (state.failed) return ;
            if ( state.backtracking==0 ) {

              			out(","+(st!=null?st.getText():null)+",\"");
              			String cells = getCells((ex!=null?((CommonTree)ex.start):null));
              			out(cells);
              			out("\")\r");
              			out("}catch(Exception ex){\r");
              			out("if(!(ex instanceof NumberFormatException)&&!(ex instanceof ArithmeticException))\r");
              			out("addErrors("+(st!=null?st.getText():null)+",\""+cells+"\")\r");
              			out("}\r");
              		
            }

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "duplicateSureStatement"


    // $ANTLR start "inListStatement"
    // RiseCollectionFormulaServerAST.g:167:1: inListStatement : ( ^( IN Identifier ^( TO de1= DecimalLiteral de2= DecimalLiteral ) (de3= DecimalLiteral )? ) | ^( IN Identifier ^( DECINODE ( DecimalLiteral )+ ) ) );
    public final void inListStatement() throws RecognitionException {
        CommonTree de1=null;
        CommonTree de2=null;
        CommonTree de3=null;
        CommonTree Identifier1=null;
        CommonTree DECINODE2=null;
        CommonTree Identifier3=null;

        try {
            // RiseCollectionFormulaServerAST.g:168:2: ( ^( IN Identifier ^( TO de1= DecimalLiteral de2= DecimalLiteral ) (de3= DecimalLiteral )? ) | ^( IN Identifier ^( DECINODE ( DecimalLiteral )+ ) ) )
            int alt17=2;
            int LA17_0 = input.LA(1);

            if ( (LA17_0==IN) ) {
                int LA17_1 = input.LA(2);

                if ( (LA17_1==DOWN) ) {
                    int LA17_2 = input.LA(3);

                    if ( (LA17_2==Identifier) ) {
                        int LA17_3 = input.LA(4);

                        if ( (LA17_3==TO) ) {
                            alt17=1;
                        }
                        else if ( (LA17_3==DECINODE) ) {
                            alt17=2;
                        }
                        else {
                            if (state.backtracking>0) {state.failed=true; return ;}
                            NoViableAltException nvae =
                                new NoViableAltException("", 17, 3, input);

                            throw nvae;
                        }
                    }
                    else {
                        if (state.backtracking>0) {state.failed=true; return ;}
                        NoViableAltException nvae =
                            new NoViableAltException("", 17, 2, input);

                        throw nvae;
                    }
                }
                else {
                    if (state.backtracking>0) {state.failed=true; return ;}
                    NoViableAltException nvae =
                        new NoViableAltException("", 17, 1, input);

                    throw nvae;
                }
            }
            else {
                if (state.backtracking>0) {state.failed=true; return ;}
                NoViableAltException nvae =
                    new NoViableAltException("", 17, 0, input);

                throw nvae;
            }
            switch (alt17) {
                case 1 :
                    // RiseCollectionFormulaServerAST.g:168:4: ^( IN Identifier ^( TO de1= DecimalLiteral de2= DecimalLiteral ) (de3= DecimalLiteral )? )
                    {
                    match(input,IN,FOLLOW_IN_in_inListStatement383); if (state.failed) return ;

                    match(input, Token.DOWN, null); if (state.failed) return ;
                    Identifier1=(CommonTree)match(input,Identifier,FOLLOW_Identifier_in_inListStatement385); if (state.failed) return ;
                    match(input,TO,FOLLOW_TO_in_inListStatement388); if (state.failed) return ;

                    match(input, Token.DOWN, null); if (state.failed) return ;
                    de1=(CommonTree)match(input,DecimalLiteral,FOLLOW_DecimalLiteral_in_inListStatement392); if (state.failed) return ;
                    de2=(CommonTree)match(input,DecimalLiteral,FOLLOW_DecimalLiteral_in_inListStatement396); if (state.failed) return ;

                    match(input, Token.UP, null); if (state.failed) return ;
                    // RiseCollectionFormulaServerAST.g:168:67: (de3= DecimalLiteral )?
                    int alt15=2;
                    int LA15_0 = input.LA(1);

                    if ( (LA15_0==DecimalLiteral) ) {
                        alt15=1;
                    }
                    switch (alt15) {
                        case 1 :
                            // RiseCollectionFormulaServerAST.g:0:0: de3= DecimalLiteral
                            {
                            de3=(CommonTree)match(input,DecimalLiteral,FOLLOW_DecimalLiteral_in_inListStatement401); if (state.failed) return ;

                            }
                            break;

                    }


                    match(input, Token.UP, null); if (state.failed) return ;
                    if ( state.backtracking==0 ) {

                      			String i = "1";
                      			if(de3!=null){
                      				i = (de3!=null?de3.getText():null);
                      			}
                      			
                      			Object o = memory.get("forInListStatementList"+(Identifier1!=null?Identifier1.getText():null));
                      			if(o==null){
                      				out("def forInListStatementList"+(Identifier1!=null?Identifier1.getText():null)+" = makeInListStatementList(");
                      				memory.put("forInListStatementList"+(Identifier1!=null?Identifier1.getText():null),"0");
                      			}else{
                      				out("forInListStatementList"+(Identifier1!=null?Identifier1.getText():null)+" = makeInListStatementList(");
                      			}
                      				
                      			out("\""+(de1!=null?de1.getText():null)+"\",\""+(de2!=null?de2.getText():null)+"\","+i+")\r");
                      						
                      			out("for(");
                      			out((Identifier1!=null?Identifier1.getText():null));
                      			out(" in forInListStatementList"+(Identifier1!=null?Identifier1.getText():null)+"){\r");
                      			out("localVariables.put(\"");
                      			out((Identifier1!=null?Identifier1.getText():null));
                      			out("\",");
                      			out((Identifier1!=null?Identifier1.getText():null));
                      			out(")\r");
                      		
                    }

                    }
                    break;
                case 2 :
                    // RiseCollectionFormulaServerAST.g:194:4: ^( IN Identifier ^( DECINODE ( DecimalLiteral )+ ) )
                    {
                    match(input,IN,FOLLOW_IN_in_inListStatement413); if (state.failed) return ;

                    match(input, Token.DOWN, null); if (state.failed) return ;
                    Identifier3=(CommonTree)match(input,Identifier,FOLLOW_Identifier_in_inListStatement415); if (state.failed) return ;
                    DECINODE2=(CommonTree)match(input,DECINODE,FOLLOW_DECINODE_in_inListStatement418); if (state.failed) return ;

                    match(input, Token.DOWN, null); if (state.failed) return ;
                    // RiseCollectionFormulaServerAST.g:194:31: ( DecimalLiteral )+
                    int cnt16=0;
                    loop16:
                    do {
                        int alt16=2;
                        int LA16_0 = input.LA(1);

                        if ( (LA16_0==DecimalLiteral) ) {
                            alt16=1;
                        }


                        switch (alt16) {
                    	case 1 :
                    	    // RiseCollectionFormulaServerAST.g:0:0: DecimalLiteral
                    	    {
                    	    match(input,DecimalLiteral,FOLLOW_DecimalLiteral_in_inListStatement420); if (state.failed) return ;

                    	    }
                    	    break;

                    	default :
                    	    if ( cnt16 >= 1 ) break loop16;
                    	    if (state.backtracking>0) {state.failed=true; return ;}
                                EarlyExitException eee =
                                    new EarlyExitException(16, input);
                                throw eee;
                        }
                        cnt16++;
                    } while (true);


                    match(input, Token.UP, null); if (state.failed) return ;

                    match(input, Token.UP, null); if (state.failed) return ;
                    if ( state.backtracking==0 ) {

                      			CommonTree ct = DECINODE2;
                      			int count = ct.getChildCount();
                                         	for(int i=0;i<count;i++){
                                         		System.out.println("3============================="+ct.getChild(i).getText());
                                         	}
                                         	
                                         	//for(Identifier3 in list)
                      		
                    }

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "inListStatement"

    public static class expression_return extends TreeRuleReturnScope {
    };

    // $ANTLR start "expression"
    // RiseCollectionFormulaServerAST.g:206:1: expression : ( ^( '||' expression expression ) | ^( '&&' expression expression ) | ^( '==' expression expression ) | ^( '>=' expression expression ) | ^( '<=' expression expression ) | ^( '>' expression expression ) | ^( '<' expression expression ) | ^( '!=' expression expression ) | ^( '<>' expression expression ) | ^( '+' expression expression ) | ^( '-' expression expression ) | ^( '*' expression expression ) | ^( '/' expression expression ) | ^( '%' expression expression ) | ^( '+..+' rc1= RANGECELL rc2= RANGECELL ) | primary );
    public final RiseCollectionFormulaServerAST.expression_return expression() throws RecognitionException {
        RiseCollectionFormulaServerAST.expression_return retval = new RiseCollectionFormulaServerAST.expression_return();
        retval.start = input.LT(1);

        CommonTree rc1=null;
        CommonTree rc2=null;

        try {
            // RiseCollectionFormulaServerAST.g:207:2: ( ^( '||' expression expression ) | ^( '&&' expression expression ) | ^( '==' expression expression ) | ^( '>=' expression expression ) | ^( '<=' expression expression ) | ^( '>' expression expression ) | ^( '<' expression expression ) | ^( '!=' expression expression ) | ^( '<>' expression expression ) | ^( '+' expression expression ) | ^( '-' expression expression ) | ^( '*' expression expression ) | ^( '/' expression expression ) | ^( '%' expression expression ) | ^( '+..+' rc1= RANGECELL rc2= RANGECELL ) | primary )
            int alt18=16;
            switch ( input.LA(1) ) {
            case 51:
                {
                alt18=1;
                }
                break;
            case 52:
                {
                alt18=2;
                }
                break;
            case 53:
                {
                alt18=3;
                }
                break;
            case 56:
                {
                alt18=4;
                }
                break;
            case 57:
                {
                alt18=5;
                }
                break;
            case 58:
                {
                alt18=6;
                }
                break;
            case 59:
                {
                alt18=7;
                }
                break;
            case 54:
                {
                alt18=8;
                }
                break;
            case 55:
                {
                alt18=9;
                }
                break;
            case 60:
                {
                alt18=10;
                }
                break;
            case 45:
                {
                alt18=11;
                }
                break;
            case 61:
                {
                alt18=12;
                }
                break;
            case 62:
                {
                alt18=13;
                }
                break;
            case 63:
                {
                alt18=14;
                }
                break;
            case 68:
                {
                alt18=15;
                }
                break;
            case Identifier:
            case DecimalLiteral:
            case StringLiteral:
            case RANGECELL:
            case INDICATIONCELL:
            case ZZJGDM:
            case TBR:
            case BGQ:
            case TBRQ:
            case QYMC:
            case LEN:
            case NOTEMPTY:
            case EMPTY:
            case ABS:
            case FloatingPointLiteral:
            case CharacterLiteral:
            case 46:
            case 65:
            case 66:
            case 67:
                {
                alt18=16;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 18, 0, input);

                throw nvae;
            }

            switch (alt18) {
                case 1 :
                    // RiseCollectionFormulaServerAST.g:207:4: ^( '||' expression expression )
                    {
                    match(input,51,FOLLOW_51_in_expression440); if (state.failed) return retval;

                    match(input, Token.DOWN, null); if (state.failed) return retval;
                    pushFollow(FOLLOW_expression_in_expression442);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                      out("||");
                    }
                    pushFollow(FOLLOW_expression_in_expression446);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;

                    match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 2 :
                    // RiseCollectionFormulaServerAST.g:208:4: ^( '&&' expression expression )
                    {
                    match(input,52,FOLLOW_52_in_expression453); if (state.failed) return retval;

                    match(input, Token.DOWN, null); if (state.failed) return retval;
                    pushFollow(FOLLOW_expression_in_expression455);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                      out("&&");
                    }
                    pushFollow(FOLLOW_expression_in_expression459);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;

                    match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 3 :
                    // RiseCollectionFormulaServerAST.g:209:4: ^( '==' expression expression )
                    {
                    match(input,53,FOLLOW_53_in_expression466); if (state.failed) return retval;

                    match(input, Token.DOWN, null); if (state.failed) return retval;
                    pushFollow(FOLLOW_expression_in_expression468);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                      out("==");
                    }
                    pushFollow(FOLLOW_expression_in_expression472);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;

                    match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 4 :
                    // RiseCollectionFormulaServerAST.g:210:4: ^( '>=' expression expression )
                    {
                    match(input,56,FOLLOW_56_in_expression479); if (state.failed) return retval;

                    match(input, Token.DOWN, null); if (state.failed) return retval;
                    pushFollow(FOLLOW_expression_in_expression481);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                      out(">=");
                    }
                    pushFollow(FOLLOW_expression_in_expression485);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;

                    match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 5 :
                    // RiseCollectionFormulaServerAST.g:211:4: ^( '<=' expression expression )
                    {
                    match(input,57,FOLLOW_57_in_expression492); if (state.failed) return retval;

                    match(input, Token.DOWN, null); if (state.failed) return retval;
                    pushFollow(FOLLOW_expression_in_expression494);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                      out("<=");
                    }
                    pushFollow(FOLLOW_expression_in_expression498);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;

                    match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 6 :
                    // RiseCollectionFormulaServerAST.g:212:4: ^( '>' expression expression )
                    {
                    match(input,58,FOLLOW_58_in_expression505); if (state.failed) return retval;

                    match(input, Token.DOWN, null); if (state.failed) return retval;
                    pushFollow(FOLLOW_expression_in_expression507);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                      out(">");
                    }
                    pushFollow(FOLLOW_expression_in_expression511);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;

                    match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 7 :
                    // RiseCollectionFormulaServerAST.g:213:4: ^( '<' expression expression )
                    {
                    match(input,59,FOLLOW_59_in_expression518); if (state.failed) return retval;

                    match(input, Token.DOWN, null); if (state.failed) return retval;
                    pushFollow(FOLLOW_expression_in_expression520);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                      out("<");
                    }
                    pushFollow(FOLLOW_expression_in_expression524);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;

                    match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 8 :
                    // RiseCollectionFormulaServerAST.g:214:4: ^( '!=' expression expression )
                    {
                    match(input,54,FOLLOW_54_in_expression531); if (state.failed) return retval;

                    match(input, Token.DOWN, null); if (state.failed) return retval;
                    pushFollow(FOLLOW_expression_in_expression533);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                      out("!=");
                    }
                    pushFollow(FOLLOW_expression_in_expression537);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;

                    match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 9 :
                    // RiseCollectionFormulaServerAST.g:215:4: ^( '<>' expression expression )
                    {
                    match(input,55,FOLLOW_55_in_expression544); if (state.failed) return retval;

                    match(input, Token.DOWN, null); if (state.failed) return retval;
                    pushFollow(FOLLOW_expression_in_expression546);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                      out("!=");
                    }
                    pushFollow(FOLLOW_expression_in_expression550);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;

                    match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 10 :
                    // RiseCollectionFormulaServerAST.g:216:4: ^( '+' expression expression )
                    {
                    match(input,60,FOLLOW_60_in_expression557); if (state.failed) return retval;

                    match(input, Token.DOWN, null); if (state.failed) return retval;
                    pushFollow(FOLLOW_expression_in_expression559);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                      out("+");
                    }
                    pushFollow(FOLLOW_expression_in_expression563);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;

                    match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 11 :
                    // RiseCollectionFormulaServerAST.g:217:5: ^( '-' expression expression )
                    {
                    match(input,45,FOLLOW_45_in_expression571); if (state.failed) return retval;

                    match(input, Token.DOWN, null); if (state.failed) return retval;
                    pushFollow(FOLLOW_expression_in_expression573);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                      out("-");
                    }
                    pushFollow(FOLLOW_expression_in_expression577);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;

                    match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 12 :
                    // RiseCollectionFormulaServerAST.g:218:4: ^( '*' expression expression )
                    {
                    match(input,61,FOLLOW_61_in_expression584); if (state.failed) return retval;

                    match(input, Token.DOWN, null); if (state.failed) return retval;
                    pushFollow(FOLLOW_expression_in_expression586);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                      out("*");
                    }
                    pushFollow(FOLLOW_expression_in_expression590);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;

                    match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 13 :
                    // RiseCollectionFormulaServerAST.g:219:6: ^( '/' expression expression )
                    {
                    match(input,62,FOLLOW_62_in_expression599); if (state.failed) return retval;

                    match(input, Token.DOWN, null); if (state.failed) return retval;
                    pushFollow(FOLLOW_expression_in_expression601);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                      out("/");
                    }
                    pushFollow(FOLLOW_expression_in_expression605);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;

                    match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 14 :
                    // RiseCollectionFormulaServerAST.g:220:4: ^( '%' expression expression )
                    {
                    match(input,63,FOLLOW_63_in_expression612); if (state.failed) return retval;

                    match(input, Token.DOWN, null); if (state.failed) return retval;
                    pushFollow(FOLLOW_expression_in_expression614);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;
                    pushFollow(FOLLOW_expression_in_expression616);
                    expression();

                    state._fsp--;
                    if (state.failed) return retval;

                    match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 15 :
                    // RiseCollectionFormulaServerAST.g:221:4: ^( '+..+' rc1= RANGECELL rc2= RANGECELL )
                    {
                    match(input,68,FOLLOW_68_in_expression623); if (state.failed) return retval;

                    match(input, Token.DOWN, null); if (state.failed) return retval;
                    rc1=(CommonTree)match(input,RANGECELL,FOLLOW_RANGECELL_in_expression627); if (state.failed) return retval;
                    rc2=(CommonTree)match(input,RANGECELL,FOLLOW_RANGECELL_in_expression631); if (state.failed) return retval;

                    match(input, Token.UP, null); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {

                      			System.out.println((rc1!=null?rc1.getText():null)+"========================================="+(rc2!=null?rc2.getText():null));
                      		
                    }

                    }
                    break;
                case 16 :
                    // RiseCollectionFormulaServerAST.g:225:4: primary
                    {
                    pushFollow(FOLLOW_primary_in_expression641);
                    primary();

                    state._fsp--;
                    if (state.failed) return retval;

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "expression"


    // $ANTLR start "primary"
    // RiseCollectionFormulaServerAST.g:228:1: primary : ( parExpression | ^( ABS ak2= assignkeywords ) | ^( LEN ak= assignkeywords ) | ^( NOTEMPTY ak= assignkeywords ) | ^( EMPTY ak= assignkeywords ) | Identifier | literal | reportkeywords | reference );
    public final void primary() throws RecognitionException {
        CommonTree Identifier4=null;
        String ak2 = null;

        String ak = null;


        try {
            // RiseCollectionFormulaServerAST.g:229:6: ( parExpression | ^( ABS ak2= assignkeywords ) | ^( LEN ak= assignkeywords ) | ^( NOTEMPTY ak= assignkeywords ) | ^( EMPTY ak= assignkeywords ) | Identifier | literal | reportkeywords | reference )
            int alt19=9;
            switch ( input.LA(1) ) {
            case 46:
                {
                alt19=1;
                }
                break;
            case ABS:
                {
                alt19=2;
                }
                break;
            case LEN:
                {
                alt19=3;
                }
                break;
            case NOTEMPTY:
                {
                alt19=4;
                }
                break;
            case EMPTY:
                {
                alt19=5;
                }
                break;
            case Identifier:
                {
                alt19=6;
                }
                break;
            case DecimalLiteral:
            case StringLiteral:
            case FloatingPointLiteral:
            case CharacterLiteral:
            case 65:
            case 66:
            case 67:
                {
                alt19=7;
                }
                break;
            case RANGECELL:
            case INDICATIONCELL:
                {
                alt19=8;
                }
                break;
            case ZZJGDM:
            case TBR:
            case BGQ:
            case TBRQ:
            case QYMC:
                {
                alt19=9;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return ;}
                NoViableAltException nvae =
                    new NoViableAltException("", 19, 0, input);

                throw nvae;
            }

            switch (alt19) {
                case 1 :
                    // RiseCollectionFormulaServerAST.g:229:11: parExpression
                    {
                    pushFollow(FOLLOW_parExpression_in_primary660);
                    parExpression();

                    state._fsp--;
                    if (state.failed) return ;

                    }
                    break;
                case 2 :
                    // RiseCollectionFormulaServerAST.g:230:8: ^( ABS ak2= assignkeywords )
                    {
                    match(input,ABS,FOLLOW_ABS_in_primary670); if (state.failed) return ;

                    match(input, Token.DOWN, null); if (state.failed) return ;
                    pushFollow(FOLLOW_assignkeywords_in_primary674);
                    ak2=assignkeywords();

                    state._fsp--;
                    if (state.failed) return ;

                    match(input, Token.UP, null); if (state.failed) return ;
                    if ( state.backtracking==0 ) {

                          			out("abs(\""+ak2+"\")");
                          		
                    }

                    }
                    break;
                case 3 :
                    // RiseCollectionFormulaServerAST.g:234:8: ^( LEN ak= assignkeywords )
                    {
                    match(input,LEN,FOLLOW_LEN_in_primary693); if (state.failed) return ;

                    match(input, Token.DOWN, null); if (state.failed) return ;
                    pushFollow(FOLLOW_assignkeywords_in_primary697);
                    ak=assignkeywords();

                    state._fsp--;
                    if (state.failed) return ;

                    match(input, Token.UP, null); if (state.failed) return ;
                    if ( state.backtracking==0 ) {

                          			int iPos = ak.indexOf('&');
                          			if(iPos>-1){
                          				out("Integer.valueOf(len(\""+ak+"\"))");
                          			}else{
                          				String rangeCell = ak;
                          				int iPos1 = rangeCell.indexOf('[');
                      		       		int iPos2 = rangeCell.indexOf(',');
                      		       		String catalogCode = rangeCell.substring(iPos1+1,iPos2);
                      		       		if(catalogCode==null||catalogCode.equals("")){
                      			       		out("Integer.valueOf(len(\""+ak+"\",map))");
                      			       	}else{
                      			       		out("Integer.valueOf(len(\""+ak+"\"))");
                      			       	}
                          			}
                          		
                    }

                    }
                    break;
                case 4 :
                    // RiseCollectionFormulaServerAST.g:251:8: ^( NOTEMPTY ak= assignkeywords )
                    {
                    match(input,NOTEMPTY,FOLLOW_NOTEMPTY_in_primary716); if (state.failed) return ;

                    match(input, Token.DOWN, null); if (state.failed) return ;
                    pushFollow(FOLLOW_assignkeywords_in_primary720);
                    ak=assignkeywords();

                    state._fsp--;
                    if (state.failed) return ;

                    match(input, Token.UP, null); if (state.failed) return ;
                    if ( state.backtracking==0 ) {

                          			int iPos = ak.indexOf('&');
                          			if(iPos>-1){
                          				out("notEmpty(\""+ak+"\")");
                          			}else{
                          				String rangeCell = ak;
                          				int iPos1 = rangeCell.indexOf('[');
                      		       		int iPos2 = rangeCell.indexOf(',');
                      		       		String catalogCode = rangeCell.substring(iPos1+1,iPos2);
                      		       		if(catalogCode==null||catalogCode.equals("")){
                      			       		out("notEmpty(\""+ak+"\",map)");
                      			       	}else{
                      			       		out("notEmpty(\""+ak+"\")");
                      			       	}
                          			}
                          		
                    }

                    }
                    break;
                case 5 :
                    // RiseCollectionFormulaServerAST.g:268:8: ^( EMPTY ak= assignkeywords )
                    {
                    match(input,EMPTY,FOLLOW_EMPTY_in_primary739); if (state.failed) return ;

                    match(input, Token.DOWN, null); if (state.failed) return ;
                    pushFollow(FOLLOW_assignkeywords_in_primary743);
                    ak=assignkeywords();

                    state._fsp--;
                    if (state.failed) return ;

                    match(input, Token.UP, null); if (state.failed) return ;
                    if ( state.backtracking==0 ) {

                          			int iPos = ak.indexOf('&');
                          			if(iPos>-1){
                          				out("!notEmpty(\""+ak+"\")");
                          			}else{
                          				String rangeCell = ak;
                          				int iPos1 = rangeCell.indexOf('[');
                      		       		int iPos2 = rangeCell.indexOf(',');
                      		       		String catalogCode = rangeCell.substring(iPos1+1,iPos2);
                      		       		if(catalogCode==null||catalogCode.equals("")){
                      			       		out("!notEmpty(\""+ak+"\",map)");
                      			       	}else{
                      			       		out("!notEmpty(\""+ak+"\")");
                      			       	}
                          			}
                          		
                    }

                    }
                    break;
                case 6 :
                    // RiseCollectionFormulaServerAST.g:285:4: Identifier
                    {
                    Identifier4=(CommonTree)match(input,Identifier,FOLLOW_Identifier_in_primary757); if (state.failed) return ;
                    if ( state.backtracking==0 ) {
                      out((Identifier4!=null?Identifier4.getText():null));
                    }

                    }
                    break;
                case 7 :
                    // RiseCollectionFormulaServerAST.g:286:7: literal
                    {
                    pushFollow(FOLLOW_literal_in_primary766);
                    literal();

                    state._fsp--;
                    if (state.failed) return ;

                    }
                    break;
                case 8 :
                    // RiseCollectionFormulaServerAST.g:287:4: reportkeywords
                    {
                    pushFollow(FOLLOW_reportkeywords_in_primary771);
                    reportkeywords();

                    state._fsp--;
                    if (state.failed) return ;

                    }
                    break;
                case 9 :
                    // RiseCollectionFormulaServerAST.g:288:4: reference
                    {
                    pushFollow(FOLLOW_reference_in_primary776);
                    reference();

                    state._fsp--;
                    if (state.failed) return ;

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "primary"


    // $ANTLR start "assignkeywords"
    // RiseCollectionFormulaServerAST.g:291:1: assignkeywords returns [String value] : (indi= INDICATIONCELL | range= RANGECELL );
    public final String assignkeywords() throws RecognitionException {
        String value = null;

        CommonTree indi=null;
        CommonTree range=null;

        try {
            // RiseCollectionFormulaServerAST.g:292:2: (indi= INDICATIONCELL | range= RANGECELL )
            int alt20=2;
            int LA20_0 = input.LA(1);

            if ( (LA20_0==INDICATIONCELL) ) {
                alt20=1;
            }
            else if ( (LA20_0==RANGECELL) ) {
                alt20=2;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return value;}
                NoViableAltException nvae =
                    new NoViableAltException("", 20, 0, input);

                throw nvae;
            }
            switch (alt20) {
                case 1 :
                    // RiseCollectionFormulaServerAST.g:292:4: indi= INDICATIONCELL
                    {
                    indi=(CommonTree)match(input,INDICATIONCELL,FOLLOW_INDICATIONCELL_in_assignkeywords796); if (state.failed) return value;
                    if ( state.backtracking==0 ) {
                      value = (indi!=null?indi.getText():null);
                    }

                    }
                    break;
                case 2 :
                    // RiseCollectionFormulaServerAST.g:293:8: range= RANGECELL
                    {
                    range=(CommonTree)match(input,RANGECELL,FOLLOW_RANGECELL_in_assignkeywords808); if (state.failed) return value;
                    if ( state.backtracking==0 ) {
                      value = (range!=null?range.getText():null);
                    }

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return value;
    }
    // $ANTLR end "assignkeywords"


    // $ANTLR start "reportkeywords"
    // RiseCollectionFormulaServerAST.g:296:1: reportkeywords : ( INDICATIONCELL | RANGECELL );
    public final void reportkeywords() throws RecognitionException {
        CommonTree INDICATIONCELL5=null;
        CommonTree RANGECELL6=null;

        try {
            // RiseCollectionFormulaServerAST.g:297:2: ( INDICATIONCELL | RANGECELL )
            int alt21=2;
            int LA21_0 = input.LA(1);

            if ( (LA21_0==INDICATIONCELL) ) {
                alt21=1;
            }
            else if ( (LA21_0==RANGECELL) ) {
                alt21=2;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return ;}
                NoViableAltException nvae =
                    new NoViableAltException("", 21, 0, input);

                throw nvae;
            }
            switch (alt21) {
                case 1 :
                    // RiseCollectionFormulaServerAST.g:297:4: INDICATIONCELL
                    {
                    INDICATIONCELL5=(CommonTree)match(input,INDICATIONCELL,FOLLOW_INDICATIONCELL_in_reportkeywords824); if (state.failed) return ;
                    if ( state.backtracking==0 ) {

                      			out("getIndicationValue(\""+(INDICATIONCELL5!=null?INDICATIONCELL5.getText():null)+"\")");
                      		
                    }

                    }
                    break;
                case 2 :
                    // RiseCollectionFormulaServerAST.g:301:8: RANGECELL
                    {
                    RANGECELL6=(CommonTree)match(input,RANGECELL,FOLLOW_RANGECELL_in_reportkeywords837); if (state.failed) return ;
                    if ( state.backtracking==0 ) {

                      		       	String rangeCell = (RANGECELL6!=null?RANGECELL6.getText():null);
                      		       	int iPos1 = rangeCell.indexOf('[');
                      		       	int iPos2 = rangeCell.indexOf(',');
                      		       	String catalogCode = rangeCell.substring(iPos1+1,iPos2);
                      		       	if(catalogCode==null||catalogCode.equals("")){
                      		       		out("getRangeCellValue(\""+(RANGECELL6!=null?RANGECELL6.getText():null)+"\",map)");
                      		       	}else{
                      		       		out("getRangeCellValue(\""+(RANGECELL6!=null?RANGECELL6.getText():null)+"\")");
                      		       	}
                          		
                    }

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "reportkeywords"


    // $ANTLR start "referenceassign"
    // RiseCollectionFormulaServerAST.g:315:1: referenceassign returns [String value] : ( ZZJGDM | TBR | bgq= BGQ | tbrq= TBRQ | QYMC );
    public final String referenceassign() throws RecognitionException {
        String value = null;

        CommonTree bgq=null;
        CommonTree tbrq=null;

        try {
            // RiseCollectionFormulaServerAST.g:316:2: ( ZZJGDM | TBR | bgq= BGQ | tbrq= TBRQ | QYMC )
            int alt22=5;
            switch ( input.LA(1) ) {
            case ZZJGDM:
                {
                alt22=1;
                }
                break;
            case TBR:
                {
                alt22=2;
                }
                break;
            case BGQ:
                {
                alt22=3;
                }
                break;
            case TBRQ:
                {
                alt22=4;
                }
                break;
            case QYMC:
                {
                alt22=5;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return value;}
                NoViableAltException nvae =
                    new NoViableAltException("", 22, 0, input);

                throw nvae;
            }

            switch (alt22) {
                case 1 :
                    // RiseCollectionFormulaServerAST.g:316:4: ZZJGDM
                    {
                    match(input,ZZJGDM,FOLLOW_ZZJGDM_in_referenceassign860); if (state.failed) return value;
                    if ( state.backtracking==0 ) {
                      value = "getZZJGDM()";
                    }

                    }
                    break;
                case 2 :
                    // RiseCollectionFormulaServerAST.g:317:8: TBR
                    {
                    match(input,TBR,FOLLOW_TBR_in_referenceassign870); if (state.failed) return value;
                    if ( state.backtracking==0 ) {
                      value = "getTBR()";
                    }

                    }
                    break;
                case 3 :
                    // RiseCollectionFormulaServerAST.g:318:8: bgq= BGQ
                    {
                    bgq=(CommonTree)match(input,BGQ,FOLLOW_BGQ_in_referenceassign882); if (state.failed) return value;
                    if ( state.backtracking==0 ) {
                      value = "getBGQ(\""+(bgq!=null?bgq.getText():null)+"\")";
                    }

                    }
                    break;
                case 4 :
                    // RiseCollectionFormulaServerAST.g:319:8: tbrq= TBRQ
                    {
                    tbrq=(CommonTree)match(input,TBRQ,FOLLOW_TBRQ_in_referenceassign894); if (state.failed) return value;
                    if ( state.backtracking==0 ) {
                      value = "getTBRQ(\""+(tbrq!=null?tbrq.getText():null)+"\")";
                    }

                    }
                    break;
                case 5 :
                    // RiseCollectionFormulaServerAST.g:320:8: QYMC
                    {
                    match(input,QYMC,FOLLOW_QYMC_in_referenceassign904); if (state.failed) return value;
                    if ( state.backtracking==0 ) {
                      value = "getQYMC()";
                    }

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return value;
    }
    // $ANTLR end "referenceassign"


    // $ANTLR start "reference"
    // RiseCollectionFormulaServerAST.g:323:1: reference : ( ZZJGDM | TBR | bgq= BGQ | tbrq= TBRQ | QYMC );
    public final void reference() throws RecognitionException {
        CommonTree bgq=null;
        CommonTree tbrq=null;

        try {
            // RiseCollectionFormulaServerAST.g:324:2: ( ZZJGDM | TBR | bgq= BGQ | tbrq= TBRQ | QYMC )
            int alt23=5;
            switch ( input.LA(1) ) {
            case ZZJGDM:
                {
                alt23=1;
                }
                break;
            case TBR:
                {
                alt23=2;
                }
                break;
            case BGQ:
                {
                alt23=3;
                }
                break;
            case TBRQ:
                {
                alt23=4;
                }
                break;
            case QYMC:
                {
                alt23=5;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return ;}
                NoViableAltException nvae =
                    new NoViableAltException("", 23, 0, input);

                throw nvae;
            }

            switch (alt23) {
                case 1 :
                    // RiseCollectionFormulaServerAST.g:324:4: ZZJGDM
                    {
                    match(input,ZZJGDM,FOLLOW_ZZJGDM_in_reference917); if (state.failed) return ;
                    if ( state.backtracking==0 ) {
                      out("getZZJGDM()");
                    }

                    }
                    break;
                case 2 :
                    // RiseCollectionFormulaServerAST.g:325:8: TBR
                    {
                    match(input,TBR,FOLLOW_TBR_in_reference927); if (state.failed) return ;
                    if ( state.backtracking==0 ) {
                      out("getTBR()");
                    }

                    }
                    break;
                case 3 :
                    // RiseCollectionFormulaServerAST.g:326:8: bgq= BGQ
                    {
                    bgq=(CommonTree)match(input,BGQ,FOLLOW_BGQ_in_reference939); if (state.failed) return ;
                    if ( state.backtracking==0 ) {
                      out("getBGQ(\""+(bgq!=null?bgq.getText():null)+"\")");
                    }

                    }
                    break;
                case 4 :
                    // RiseCollectionFormulaServerAST.g:327:8: tbrq= TBRQ
                    {
                    tbrq=(CommonTree)match(input,TBRQ,FOLLOW_TBRQ_in_reference951); if (state.failed) return ;
                    if ( state.backtracking==0 ) {
                      out("getTBRQ(\""+(tbrq!=null?tbrq.getText():null)+"\")");
                    }

                    }
                    break;
                case 5 :
                    // RiseCollectionFormulaServerAST.g:328:8: QYMC
                    {
                    match(input,QYMC,FOLLOW_QYMC_in_reference961); if (state.failed) return ;
                    if ( state.backtracking==0 ) {
                      out("getQYMC()");
                    }

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "reference"


    // $ANTLR start "parExpression"
    // RiseCollectionFormulaServerAST.g:331:1: parExpression : ^( '(' expression ')' ) ;
    public final void parExpression() throws RecognitionException {
        try {
            // RiseCollectionFormulaServerAST.g:332:6: ( ^( '(' expression ')' ) )
            // RiseCollectionFormulaServerAST.g:332:10: ^( '(' expression ')' )
            {
            match(input,46,FOLLOW_46_in_parExpression989); if (state.failed) return ;

            if ( state.backtracking==0 ) {
              out("(");
            }

            match(input, Token.DOWN, null); if (state.failed) return ;
            pushFollow(FOLLOW_expression_in_parExpression992);
            expression();

            state._fsp--;
            if (state.failed) return ;
            match(input,47,FOLLOW_47_in_parExpression994); if (state.failed) return ;
            if ( state.backtracking==0 ) {
              out(")");
            }

            match(input, Token.UP, null); if (state.failed) return ;

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "parExpression"


    // $ANTLR start "literal"
    // RiseCollectionFormulaServerAST.g:335:1: literal : ( DecimalLiteral | FloatingPointLiteral | CharacterLiteral | StringLiteral | booleanLiteral | 'null' );
    public final void literal() throws RecognitionException {
        CommonTree DecimalLiteral7=null;
        CommonTree FloatingPointLiteral8=null;
        CommonTree StringLiteral9=null;

        try {
            // RiseCollectionFormulaServerAST.g:336:6: ( DecimalLiteral | FloatingPointLiteral | CharacterLiteral | StringLiteral | booleanLiteral | 'null' )
            int alt24=6;
            switch ( input.LA(1) ) {
            case DecimalLiteral:
                {
                alt24=1;
                }
                break;
            case FloatingPointLiteral:
                {
                alt24=2;
                }
                break;
            case CharacterLiteral:
                {
                alt24=3;
                }
                break;
            case StringLiteral:
                {
                alt24=4;
                }
                break;
            case 66:
            case 67:
                {
                alt24=5;
                }
                break;
            case 65:
                {
                alt24=6;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return ;}
                NoViableAltException nvae =
                    new NoViableAltException("", 24, 0, input);

                throw nvae;
            }

            switch (alt24) {
                case 1 :
                    // RiseCollectionFormulaServerAST.g:336:10: DecimalLiteral
                    {
                    DecimalLiteral7=(CommonTree)match(input,DecimalLiteral,FOLLOW_DecimalLiteral_in_literal1022); if (state.failed) return ;
                    if ( state.backtracking==0 ) {
                      out((DecimalLiteral7!=null?DecimalLiteral7.getText():null));
                    }

                    }
                    break;
                case 2 :
                    // RiseCollectionFormulaServerAST.g:337:10: FloatingPointLiteral
                    {
                    FloatingPointLiteral8=(CommonTree)match(input,FloatingPointLiteral,FOLLOW_FloatingPointLiteral_in_literal1034); if (state.failed) return ;
                    if ( state.backtracking==0 ) {
                      out((FloatingPointLiteral8!=null?FloatingPointLiteral8.getText():null));
                    }

                    }
                    break;
                case 3 :
                    // RiseCollectionFormulaServerAST.g:338:10: CharacterLiteral
                    {
                    match(input,CharacterLiteral,FOLLOW_CharacterLiteral_in_literal1046); if (state.failed) return ;

                    }
                    break;
                case 4 :
                    // RiseCollectionFormulaServerAST.g:339:10: StringLiteral
                    {
                    StringLiteral9=(CommonTree)match(input,StringLiteral,FOLLOW_StringLiteral_in_literal1057); if (state.failed) return ;
                    if ( state.backtracking==0 ) {
                      out((StringLiteral9!=null?StringLiteral9.getText():null));
                    }

                    }
                    break;
                case 5 :
                    // RiseCollectionFormulaServerAST.g:340:10: booleanLiteral
                    {
                    pushFollow(FOLLOW_booleanLiteral_in_literal1069);
                    booleanLiteral();

                    state._fsp--;
                    if (state.failed) return ;

                    }
                    break;
                case 6 :
                    // RiseCollectionFormulaServerAST.g:341:10: 'null'
                    {
                    match(input,65,FOLLOW_65_in_literal1080); if (state.failed) return ;

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "literal"


    // $ANTLR start "booleanLiteral"
    // RiseCollectionFormulaServerAST.g:344:1: booleanLiteral : ( 'true' | 'false' );
    public final void booleanLiteral() throws RecognitionException {
        try {
            // RiseCollectionFormulaServerAST.g:345:5: ( 'true' | 'false' )
            // RiseCollectionFormulaServerAST.g:
            {
            if ( (input.LA(1)>=66 && input.LA(1)<=67) ) {
                input.consume();
                state.errorRecovery=false;state.failed=false;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return ;}
                MismatchedSetException mse = new MismatchedSetException(null,input);
                throw mse;
            }


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "booleanLiteral"

    // $ANTLR start synpred19_RiseCollectionFormulaServerAST
    public final void synpred19_RiseCollectionFormulaServerAST_fragment() throws RecognitionException {   
        // RiseCollectionFormulaServerAST.g:144:4: ( duplicateSureStatement )
        // RiseCollectionFormulaServerAST.g:144:4: duplicateSureStatement
        {
        pushFollow(FOLLOW_duplicateSureStatement_in_synpred19_RiseCollectionFormulaServerAST333);
        duplicateSureStatement();

        state._fsp--;
        if (state.failed) return ;

        }
    }
    // $ANTLR end synpred19_RiseCollectionFormulaServerAST

    // Delegated rules

    public final boolean synpred19_RiseCollectionFormulaServerAST() {
        state.backtracking++;
        int start = input.mark();
        try {
            synpred19_RiseCollectionFormulaServerAST_fragment(); // can never throw exception
        } catch (RecognitionException re) {
            System.err.println("impossible: "+re);
        }
        boolean success = !state.failed;
        input.rewind(start);
        state.backtracking--;
        state.failed=false;
        return success;
    }


 

    public static final BitSet FOLLOW_statement_in_prog56 = new BitSet(new long[]{0x00000800000262A0L});
    public static final BitSet FOLLOW_EOF_in_prog59 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ifStatement_in_statement70 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_FOR_in_statement76 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_inListStatement_in_statement78 = new BitSet(new long[]{0x00000800000262A8L});
    public static final BitSet FOLLOW_statement_in_statement80 = new BitSet(new long[]{0x00000800000262A8L});
    public static final BitSet FOLLOW_FOREACH_in_statement90 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_statement_in_statement106 = new BitSet(new long[]{0x00000800000262A8L});
    public static final BitSet FOLLOW_assignStatement_in_statement122 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_asAssignStatement_in_statement127 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_openStatement_in_statement132 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_functionStatement_in_statement137 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_IF_in_ifStatement152 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_ifStatement156 = new BitSet(new long[]{0x0000080000026AA8L});
    public static final BitSet FOLLOW_statement_in_ifStatement160 = new BitSet(new long[]{0x0000080000026AA8L});
    public static final BitSet FOLLOW_elseStatement_in_ifStatement165 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_ELSE_in_elseStatement182 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_statement_in_elseStatement184 = new BitSet(new long[]{0x00000800000262A8L});
    public static final BitSet FOLLOW_43_in_assignStatement199 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_assignkeywords_in_assignStatement203 = new BitSet(new long[]{0x000000000F800000L});
    public static final BitSet FOLLOW_referenceassign_in_assignStatement207 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_AS_in_asAssignStatement225 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_Identifier_in_asAssignStatement229 = new BitSet(new long[]{0x0000000000001000L});
    public static final BitSet FOLLOW_Identifier_in_asAssignStatement233 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_AS_in_asAssignStatement245 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_Identifier_in_asAssignStatement249 = new BitSet(new long[]{0x0000000000001000L});
    public static final BitSet FOLLOW_Identifier_in_asAssignStatement253 = new BitSet(new long[]{0x0000000000001000L});
    public static final BitSet FOLLOW_Identifier_in_asAssignStatement257 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_OPEN_in_openStatement275 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_Identifier_in_openStatement279 = new BitSet(new long[]{0x0000000000009008L});
    public static final BitSet FOLLOW_Identifier_in_openStatement283 = new BitSet(new long[]{0x0000000000008008L});
    public static final BitSet FOLLOW_DecimalLiteral_in_openStatement288 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_OPEN_in_openStatement300 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_Identifier_in_openStatement304 = new BitSet(new long[]{0x0000000000010000L});
    public static final BitSet FOLLOW_LY_in_openStatement306 = new BitSet(new long[]{0x0000000000009008L});
    public static final BitSet FOLLOW_Identifier_in_openStatement310 = new BitSet(new long[]{0x0000000000008008L});
    public static final BitSet FOLLOW_DecimalLiteral_in_openStatement315 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_duplicateSureStatement_in_functionStatement333 = new BitSet(new long[]{0x00000800000262A2L});
    public static final BitSet FOLLOW_SURE_in_duplicateSureStatement347 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_duplicateSureStatement361 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_StringLiteral_in_duplicateSureStatement365 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_IN_in_inListStatement383 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_Identifier_in_inListStatement385 = new BitSet(new long[]{0x0000000000100000L});
    public static final BitSet FOLLOW_TO_in_inListStatement388 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_DecimalLiteral_in_inListStatement392 = new BitSet(new long[]{0x0000000000008000L});
    public static final BitSet FOLLOW_DecimalLiteral_in_inListStatement396 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_DecimalLiteral_in_inListStatement401 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_IN_in_inListStatement413 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_Identifier_in_inListStatement415 = new BitSet(new long[]{0x0000000000000010L});
    public static final BitSet FOLLOW_DECINODE_in_inListStatement418 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_DecimalLiteral_in_inListStatement420 = new BitSet(new long[]{0x0000000000008008L});
    public static final BitSet FOLLOW_51_in_expression440 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_expression442 = new BitSet(new long[]{0xFFF8600CFFE49000L,0x000000000000001EL});
    public static final BitSet FOLLOW_expression_in_expression446 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_52_in_expression453 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_expression455 = new BitSet(new long[]{0xFFF8600CFFE49000L,0x000000000000001EL});
    public static final BitSet FOLLOW_expression_in_expression459 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_53_in_expression466 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_expression468 = new BitSet(new long[]{0xFFF8600CFFE49000L,0x000000000000001EL});
    public static final BitSet FOLLOW_expression_in_expression472 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_56_in_expression479 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_expression481 = new BitSet(new long[]{0xFFF8600CFFE49000L,0x000000000000001EL});
    public static final BitSet FOLLOW_expression_in_expression485 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_57_in_expression492 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_expression494 = new BitSet(new long[]{0xFFF8600CFFE49000L,0x000000000000001EL});
    public static final BitSet FOLLOW_expression_in_expression498 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_58_in_expression505 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_expression507 = new BitSet(new long[]{0xFFF8600CFFE49000L,0x000000000000001EL});
    public static final BitSet FOLLOW_expression_in_expression511 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_59_in_expression518 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_expression520 = new BitSet(new long[]{0xFFF8600CFFE49000L,0x000000000000001EL});
    public static final BitSet FOLLOW_expression_in_expression524 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_54_in_expression531 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_expression533 = new BitSet(new long[]{0xFFF8600CFFE49000L,0x000000000000001EL});
    public static final BitSet FOLLOW_expression_in_expression537 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_55_in_expression544 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_expression546 = new BitSet(new long[]{0xFFF8600CFFE49000L,0x000000000000001EL});
    public static final BitSet FOLLOW_expression_in_expression550 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_60_in_expression557 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_expression559 = new BitSet(new long[]{0xFFF8600CFFE49000L,0x000000000000001EL});
    public static final BitSet FOLLOW_expression_in_expression563 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_45_in_expression571 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_expression573 = new BitSet(new long[]{0xFFF8600CFFE49000L,0x000000000000001EL});
    public static final BitSet FOLLOW_expression_in_expression577 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_61_in_expression584 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_expression586 = new BitSet(new long[]{0xFFF8600CFFE49000L,0x000000000000001EL});
    public static final BitSet FOLLOW_expression_in_expression590 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_62_in_expression599 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_expression601 = new BitSet(new long[]{0xFFF8600CFFE49000L,0x000000000000001EL});
    public static final BitSet FOLLOW_expression_in_expression605 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_63_in_expression612 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_expression614 = new BitSet(new long[]{0xFFF8600CFFE49000L,0x000000000000001EL});
    public static final BitSet FOLLOW_expression_in_expression616 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_68_in_expression623 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_RANGECELL_in_expression627 = new BitSet(new long[]{0x0000000000200000L});
    public static final BitSet FOLLOW_RANGECELL_in_expression631 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_primary_in_expression641 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_parExpression_in_primary660 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ABS_in_primary670 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_assignkeywords_in_primary674 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_LEN_in_primary693 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_assignkeywords_in_primary697 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_NOTEMPTY_in_primary716 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_assignkeywords_in_primary720 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_EMPTY_in_primary739 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_assignkeywords_in_primary743 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_Identifier_in_primary757 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_literal_in_primary766 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_reportkeywords_in_primary771 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_reference_in_primary776 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_INDICATIONCELL_in_assignkeywords796 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_RANGECELL_in_assignkeywords808 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_INDICATIONCELL_in_reportkeywords824 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_RANGECELL_in_reportkeywords837 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ZZJGDM_in_referenceassign860 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_TBR_in_referenceassign870 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_BGQ_in_referenceassign882 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_TBRQ_in_referenceassign894 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_QYMC_in_referenceassign904 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ZZJGDM_in_reference917 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_TBR_in_reference927 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_BGQ_in_reference939 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_TBRQ_in_reference951 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_QYMC_in_reference961 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_46_in_parExpression989 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expression_in_parExpression992 = new BitSet(new long[]{0x0000800000000000L});
    public static final BitSet FOLLOW_47_in_parExpression994 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_DecimalLiteral_in_literal1022 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_FloatingPointLiteral_in_literal1034 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_CharacterLiteral_in_literal1046 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_StringLiteral_in_literal1057 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_booleanLiteral_in_literal1069 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_65_in_literal1080 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_set_in_booleanLiteral0 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_duplicateSureStatement_in_synpred19_RiseCollectionFormulaServerAST333 = new BitSet(new long[]{0x0000000000000002L});

}